home *** CD-ROM | disk | FTP | other *** search
/ Fritz: All Fritz / All Fritz.zip / All Fritz / FILES / PROGSCAL / TBUTIL2.LZH / WINDMNGR.DOC < prev    next >
Text File  |  1986-02-23  |  39KB  |  1,381 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.                           ETHE WINDOW MANAGER/EDITORF
  7.                                 VERSION 1.0
  8.                              COPYRIGHT (c) 1985
  9.                                      BY
  10.                                 JIM EVERINGHAM
  11.  
  12.  
  13.  
  14.  
  15.  
  16.  
  17.  
  18.  
  19.  
  20.  
  21.  
  22.  
  23.  
  24.  
  25.  
  26.  
  27.  
  28.  
  29.  
  30.  
  31.  
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60. THE WINDOW MANAGER                                                     PAGE   1
  61.  
  62.  
  63.           
  64.  
  65.                This Program is placed in the public domain by the  author 
  66.          and may be distributed freely without modification.  If you find 
  67.          these routines to be of use or of value,  a small donation of up 
  68.          to $10.00 would be appreciated.  Those who donate will recieve a 
  69.          complete description of the program source code and its updates.  
  70.          Donations, inquiries, criticisms, or suggestions can be sent to: 
  71.  
  72.  
  73.                                   Jim Everingham 
  74.                                   318 East Sheridan Avenue 
  75.                                   Dubois,  Pa 15801
  76.                                   (814)-238-9655 
  77.                                   CIS: 75116,433 
  78.  
  79.  
  80.                I am also working on an  assembler  window  package  as  a 
  81.          project.  Any suggestions will be welcome.  
  82.           
  83.          The Following Files should be included in the Library file:
  84.                               
  85.                         Include Files:
  86.  
  87.                                  E VAR.INCF
  88.                                  E WINDMNGR.INCF
  89.                                  E GROWWIN.INCF
  90.                                  E DEMODEFS.INCF
  91.           
  92.                         Demonstration Programs:
  93.                                  
  94.                                  E DEFDEMO.PASF
  95.                                  E DEFDEMO.COMF
  96.                                  E GROWDEMO.PASF
  97.                                  E GROWDEMO.COMF
  98.                                  E WINDDEMO.PASF
  99.                                  E WINDDEMO.COMF
  100.  
  101.                         Support Programs:
  102.  
  103.                                  E WINDODEF.PASF
  104.                                  E WINDODEF.COMF
  105.                                  E PRINTMAN.BATF
  106.          
  107.          And of course this file,E WINDMNGR.DOCF & EREAD.MEF
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120. THE WINDOW MANAGER                                                     PAGE   2
  121.  
  122.  
  123.           
  124.  
  125.  
  126.          Contents
  127.  
  128.  
  129.  
  130.  
  131.  
  132.  
  133.  
  134.                
  135.                Introduction .......................... Page  4
  136.  
  137.                System Requirements ................... Page  5
  138.  
  139.                Overview of the Window Manager ........ Pages 6 - 7
  140.  
  141.                The Window Manager Routines ........... Pages 8 -14
  142.  
  143.                Pre-Defining Windows .................. Pages 13-14, 17-18
  144.  
  145.                Other Functions & Procedures .......... Pages 15-16
  146.  
  147.                Using WINDODEF.COM .................... Pages 17-18
  148.  
  149.                Monochrome Graphics ................... Page  19
  150.  
  151.                Modifying the Source code ............. Page  20
  152.  
  153.                Quick Reference Section ............... Pages 21-22
  154.           
  155.  
  156.  
  157.  
  158.  
  159.  
  160.  
  161.  
  162.  
  163.  
  164.  
  165.  
  166.  
  167.  
  168.  
  169.  
  170.  
  171.  
  172.  
  173.  
  174.  
  175.  
  176.  
  177.  
  178.  
  179.  
  180. THE WINDOW MANAGER                                                     PAGE   3
  181.  
  182.  
  183.          
  184.                                    -EIntroductionF-
  185.           
  186.           
  187.               The Window Manager/Editor System is a collection  of  ultra-
  188.          fast  window  routines written in Turbo Pascal Under PC-Dos 2.0.  
  189.          These Routines make it very easy to add a variety  of  different 
  190.          size  and  type windows into your own Turbo Pascal programs. 
  191.               When using this manual, type in the example programs to get 
  192.          a feeling of how the program operates.
  193.  
  194.  
  195.  
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202.  
  203.  
  204.  
  205.  
  206.  
  207.  
  208.  
  209.  
  210.  
  211.  
  212.  
  213.  
  214.  
  215.  
  216.  
  217.  
  218.  
  219.  
  220.  
  221.  
  222.  
  223.  
  224.  
  225.  
  226.  
  227.  
  228.  
  229.  
  230.  
  231.  
  232.  
  233.  
  234.  
  235.  
  236.  
  237.  
  238.  
  239.  
  240. THE WINDOW MANAGER                                                     PAGE   4
  241.  
  242.  
  243.           
  244.                                 -ESystem RequirementsF-
  245.  
  246.  
  247.               This Program was developed on a Columbia  MPC  1600-1  with 
  248.          256K  RAM  and a Color/Graphics adapter under PC DOS 2.0.  These 
  249.          routines will not work on a non-PC compatible system due to  the 
  250.          fact  that  it writes directly into video RAM.  I have tried the 
  251.          demos on an IBM PC and they have worked fine,  so I don't  think 
  252.          there will be any trouble getting them to work properly.  
  253.  
  254.          ENOTE:F If  when  running  the  demo's  consecutivly,  the  screen 
  255.          becomes  full  of garbage or unreadable characters,  just reboot 
  256.          your computer and they should work fine.  
  257.  
  258.  
  259.  
  260.  
  261.  
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268.  
  269.  
  270.  
  271.  
  272.  
  273.  
  274.  
  275.  
  276.  
  277.  
  278.  
  279.  
  280.  
  281.  
  282.  
  283.  
  284.  
  285.  
  286.  
  287.  
  288.  
  289.  
  290.  
  291.  
  292.  
  293.  
  294.  
  295.  
  296.  
  297.  
  298.  
  299.  
  300. THE WINDOW MANAGER                                                     PAGE   5
  301.  
  302.  
  303.           
  304.                    -EOverview of the Window Manager/Editor System F-
  305.  
  306.          
  307.               The  ability  to  create  "WINDOWS"  is  one  of  the  more 
  308.          fascinating features of the PC.  If you do not know exactly what 
  309.          windows are, I will try to explain the concept to you here.  
  310.  
  311.               A window can  be  thought  of  as  a  scrolling  area.  The 
  312.          standard  IBM  PC display consists (upon boot-up) of a scrolling 
  313.          area of 80 columns by 25 rows of characters.  This is a  window, 
  314.          whenever  the screen fills up,  it scrolls the whole screen up 1 
  315.          column allowing a blank column at the bottom of the screen.  The 
  316.          area in which to be scrolled is from column 1,  row 1 and column 
  317.          80,  row 25.  This scrolling area can be "SET" to any portion of 
  318.          the screen.  For example,  I can change the scrolling area to be 
  319.          from column 5, row 5 (upper left hand corner) and column 50, row 
  320.          20  (lower right hand corner,  see figure 1.0).  All text within 
  321.          that area (or window) will be  scrolled  and  the  rest  of  the 
  322.          screen will remain undisturbed.  
  323.  
  324.                   (1,1)          PC's Screen
  325.                     +---------------------------------------+
  326.                     |   (5,5)                               |
  327.                     |     +------------------+              |
  328.                     |     |                  |              |
  329.                     |     |                  |              |
  330.                     |     |    Area  A       |              |
  331.                     |     |                  |              |
  332.                     |     |                  |              |
  333.                     |     +------------------+              |
  334.                     |                     (50,20)           |
  335.                     |                                       |
  336.                     |          Area B                       |
  337.                     +---------------------------------------+
  338.                                                           (80,25)
  339.                      EFigure 1.0F, Screen. A=New Scrolling Area
  340.                                          B=Full viewing Area
  341.  
  342.               My new scrolling area is area A,  or a window consisting of 
  343.          the  upper-left  hand  coordinates  (5,5)  and  lower right hand 
  344.          coordinates  (50,20).  Now  whenever  I  write  to  the  screen, 
  345.          everything in area A is scrolled and area B, the main screen, is 
  346.          undisturbed  (Try  out  the  EDEFDEMO.COMF program to see how this 
  347.          works).  
  348.  
  349.               Windows  are  used in many popular programs.  Sidekick uses 
  350.          windows, Qmodem, Pc-Talk, many disk catalog programs, etc.  Many 
  351.          interesting effects can be created  with  use  of  windows.  For 
  352.          example  toggling  in between windows can create the illusion of 
  353.          many windows active on your  screen  at  once.  Windows  can  be 
  354.          created in text mode, and graphics mode also.  
  355.  
  356.                With the Window  Manager/Editor  system,  windows  can  be 
  357.          manipulated with the ease of a few new procedures which are used 
  358.          just  like  commands.  Among these are commands to add,  remove, 
  359.  
  360. THE WINDOW MANAGER                                                     PAGE   6
  361.  
  362.  
  363.          title, color, create,  scroll and move your windows around.  The 
  364.          details  of these procedures will be covered in the next section 
  365.          of this manual.  
  366.  
  367.  
  368.  
  369.  
  370.  
  371.  
  372.  
  373.  
  374.  
  375.  
  376.  
  377.  
  378.  
  379.  
  380.  
  381.  
  382.  
  383.  
  384.  
  385.  
  386.  
  387.  
  388.  
  389.  
  390.  
  391.  
  392.  
  393.  
  394.  
  395.  
  396.  
  397.  
  398.  
  399.  
  400.  
  401.  
  402.  
  403.  
  404.  
  405.  
  406.  
  407.  
  408.  
  409.  
  410.  
  411.  
  412.  
  413.  
  414.  
  415.  
  416.  
  417.  
  418.  
  419.  
  420. THE WINDOW MANAGER                                                     PAGE   7
  421.  
  422.  
  423.                
  424.                     -EImplementing Window Manager/Editor RoutinesF-
  425.  
  426.               This section will describe all routines included  with  the 
  427.          Window Manager/Editor system and detailed instructions on how to 
  428.          implement them into your own Turbo Pascal programs.  
  429.  
  430.               In all there are seven main commands to work with  (I  will 
  431.          refer  to  procedural  calls  as  "commands"  for  the  sake  of 
  432.          understanding).  
  433.  
  434.                                    1: INITIALIZE
  435.                                    2: ADD_WINDOW  
  436.                                    3: GROW_WINDOW (grow window?)
  437.                                    4: REMOVE
  438.                                    5: COLOR_WINDOW                      
  439.                                    6: WINDOW_TITLE
  440.                                    7: SELECT_WINDOW (Optional)
  441.  
  442.               To access these commands,  all that is required is that you 
  443.          include  the  following  two lines at the very beginning of your 
  444.          program: 
  445.           
  446.                                    {$I VAR.INC}
  447.                                    {$I WINDMNGR.INC}
  448.           
  449.          optional: {$I GROWWIN.INC} if you wish to use growing windows.
  450.                    {$I DEFS.INC} if you have defined windows (See section 
  451.                                  on EWINDODEF.COMF for details on this).
  452.  
  453.                We  will discuss the syntax of each of these in detail and 
  454.          then move onto the smaller functions  and  commands.  Parameters 
  455.          will be enclosed in the symbols < and > and in boldface.  
  456.  
  457.          E--Initialize--F Procedure         E--__________--F          
  458.  
  459.                Initializes  the  stack  and memory for your windows to be 
  460.          stored in.  This -MUST- be in your program before you use  any  of 
  461.          the other routines.  There is no telling what will happen if you 
  462.          don't.  
  463.  
  464.          Syntax:
  465.  
  466.                                     Initialize;
  467.  
  468.               I highly recommend getting into the habit  of  making  this 
  469.          the first line of your program.  
  470.  
  471.  
  472.          E--Add_Window--F Procedure         E--__________--F          
  473.           
  474.               Saves the current screen into memory and creates  a  framed 
  475.          window  with  the cursor positioned in the top left hand corner.  
  476.          
  477.          Syntax: 
  478.  
  479.  
  480. THE WINDOW MANAGER                                                     PAGE   8
  481.  
  482.  
  483.          Add_Window(<EX1F>,<EY1F>,<EX2F>,<EY2F>,<EForegrndF>,<EBackgrndF>,<EFrameF>);
  484.  
  485.          Where:
  486.                          EX1F is upper left hand X-coordinate
  487.                          EY1F is upper left hand Y-coordinate
  488.                          EX2F is lower right hand X-coordinate
  489.                          EY2F is lower right hand Y-coordinate
  490.                          EForegrndF is the text foreground color
  491.                          EBackgrndF is the background textcolor
  492.                          EFrameF is an integer value (1..5) wich designates 
  493.                                  the the style of frame you desire on
  494.                                  your window.
  495.                                   
  496.          EFrameF types are as follows:
  497.            
  498.                          1  A single line surrounding the window.
  499.                          2  A double line surrounding the window.
  500.                          3  Two horizontal double lines and two vertical 
  501.                             single lines surrounding the window.
  502.                          4  A solid frame the thickness of one 
  503.                             cursor surrounding the window.
  504.                          5  No frame.
  505.  
  506.          Example call:
  507.           
  508.                            Add_Window(5,5,50,20,1,2,2);
  509.                  
  510.               This call in particular will create a window with the upper 
  511.          left  hand  corner of the frame positioned at the location (5,5) 
  512.          and the lower right hand corner of the frame (not the window) at 
  513.          the location (50,20).  The color  of  the  frame  will  be  blue 
  514.          (textcolor  1)  against  a  background  of  green (textcolor 2).  
  515.          Refer to the PC-Dos  2.0  Addendum  at  the  end  of  the  Turbo 
  516.          Referance Manual or the last page of this manual for color value 
  517.          constants.  It  will  be  surrounded by frame type #2 which is a 
  518.          double lined frame.  Up to eight windows can be on the screen at 
  519.          one time unless the source code  is  modified  to  handle  more.  
  520.          This  is  explained  in the section on source modification.  Try 
  521.          this little sample program to test the Add_window procedure: 
  522.           
  523.                         {$I VAR.INC}
  524.                         {$I WINDMNGR.INC}
  525.           
  526.                         Begin
  527.                              Initialize;
  528.                              Add_window(5,5,50,20,1,2,2);
  529.                              repeat until keypressed
  530.                         end.
  531.  
  532.               When  using  the Add_Window procedure keep in mind that the 
  533.          coordinates you give will be the coordinates of the frame of the 
  534.          window.  The actual window will be (X1+1,Y1+1), (X2-1,Y2-1).  
  535.  
  536.  
  537.  
  538.  
  539.  
  540. THE WINDOW MANAGER                                                     PAGE   9
  541.  
  542.  
  543.           
  544.          E--Grow_Window--F Procedure         E--___________--F          
  545.           
  546.               This procedure is essentially the same  as  the  Add_Window 
  547.          procedure  in all respects except that the window will start out 
  548.          as a small cube in the middle of the screen and appear  to  grow 
  549.          to the size of the specified coordinates.  Wonderful huh?  
  550.           
  551.          Syntax:
  552.           
  553.          Grow_Window(<EX1F>,<EY1F>,<EX2F>,<EY2F>,<EForegrndF>,<EBackgrndF>,<EFrameF>);
  554.  
  555.               All  parameters  for the Grow_Window procedure are the same 
  556.          as in the Add_Window procedure.  
  557.  
  558.          Example call:
  559.           
  560.          Grow_Window(10,7,40,18,2,0,2);
  561.  
  562.               Try the same example program as in the Add_Window procedure 
  563.          description  only  substitute  the  Add_Window  call  with   the 
  564.          Grow_window call from above.  
  565.  
  566.          --ERemoveF-- Procedure         --E______F--          
  567.  
  568.               Removes a specified  number  of  windows  from  the  screen 
  569.          without destroying any of the underlying information.  
  570.  
  571.          Syntax:
  572.  
  573.                          Remove(<E# of windows to removeF>);
  574.   
  575.          Where:
  576.                 
  577.                          E# of windows to removeF is an integer number 
  578.                             between 1 and the number of screens that  
  579.                             are active.
  580.  
  581.          Example call:
  582.  
  583.                                     Remove(1);
  584.  
  585.              This  example  call  will  remove the top most active window 
  586.          from the screen and activate the  underlying  window.  When  the 
  587.          underlying  window  is  reactivated,  the  cursor  is positioned 
  588.          exactly where it was when you left off.  For example,  I can add 
  589.          a  window and write 'Hello' inside the window.  Whenever I add a 
  590.          new window and then remove it,  my cursor will be  automatically 
  591.          positioned  directly  after  'o'  in  'Hello'.  Here is a little 
  592.          sample program: 
  593.  
  594.                                 Program Remove_test;
  595.  
  596.                                 {$I VAR.INC}
  597.                                 {$I WINDMNGR.INC};
  598.                                 {$I GROWWIN.INC}
  599.  
  600. THE WINDOW MANAGER                                                     PAGE  10
  601.  
  602.  
  603.           
  604.                                 Var Ch: CHar;
  605.  
  606.                                 Begin
  607.                                      Initialize;
  608.                                      Add_window(5,5,50,15,1,2,3);
  609.                                      Grow_Window(30,10,60,23,11,0,2);
  610.                                      Repeat until keypressed;
  611.                                      Read(kbd, ch);
  612.                                      Remove(1);
  613.                                      Repeat until keypressed;
  614.                                      Read(kbd,ch);
  615.                                      Remove(1)
  616.                                  end.
  617.           
  618.               Whenever using the Remove procedure,  keep in mind that the 
  619.          number of windows to remove cannot be higher than the number  of 
  620.          windows that are active.  
  621.  
  622.          E--Color_Window--F Procedure         E--____________--F          
  623.  
  624.               With this command,  you may  change  the  color  attributes 
  625.          (foreground  & background colors) of the currently active window 
  626.          (the one on top).  
  627.  
  628.          Syntax:
  629.           
  630.                        Color_Window(<EForegrndF>,<EBackgrndF>);
  631.          
  632.          Where:
  633.          
  634.                        EForegrndF is the new foreground color (or text 
  635.                                   color)  to be used.
  636.  
  637.                        EBackgrndF is the new background color to be used.
  638.  
  639.          Example call:
  640.  
  641.                                 Color_Window(12,7);
  642.                             
  643.               This call will  change  the  attributes  of  the  currently 
  644.          active  window to a foreground color of red (textcolor 12) and a 
  645.          background color of light grey (textcolor 7).  Here is  a  small 
  646.          sample  program  that  will  create a window and then change the 
  647.          its color after a key is pressed: 
  648.           
  649.                             Program Change_Window_Color;
  650.  
  651.                             {$I VAR.INC}
  652.                             {$I WINDMNGR.INC}
  653.  
  654.                             Var Ch: Char;
  655.           
  656.                             Begin
  657.                                  Initialize;
  658.                                  Add_Window(20,10,60,20,12,0,2);
  659.  
  660. THE WINDOW MANAGER                                                     PAGE  11
  661.  
  662.  
  663.                                  Repeat until keypressed;
  664.                                  Read(kbd,ch);
  665.                                  Color_Window(1,7);
  666.                                  Repeat until keypressed;
  667.                                  Read(kbd,ch);
  668.                                  Remove(1)
  669.                             end.
  670.  
  671.          E--Window_Title--F Procedure         E--____________--F          
  672.  
  673.              Adds a title to the currently activated window.  The  title, 
  674.          providing  you are not using frame type #4 or #5,  is surrounded 
  675.          by brackets ([ & ]).  
  676.  
  677.          Syntax:
  678.  
  679.                   Window_Title('<ETitleF>',<EColorF>);
  680.  
  681.          Where:
  682.                         
  683.                         ETitleF is a string of characters which should be 
  684.                                 less than the width of the frame in
  685.                                 frame.  The title must be enclosed in
  686.                                 single quotes.
  687.  
  688.                         EColorF is the combination foreground-background 
  689.                                 (text color) of the title to be displayed.
  690.                                 This value is determined by the formula:
  691.  
  692.                                EColorF = Foreground + (background * 16)
  693.           
  694.                                 Example: Blue colors on a green 
  695.                                 background would be (1+(2*16)) where 1 is
  696.                                 the value for the color blue and 2 is the
  697.                                 value for the color green.
  698.          Example call:
  699.  
  700.                       Window_Title('TEST TITLE',(12+128)+(7*16)); 
  701.  
  702.               This call will place the title 'TEST TITLE' at the top left 
  703.          hand  corner  of  the  active  window.  It  will be flashing red 
  704.          characters (12+128) against  a  light  gray  background  (7*16).  
  705.          Whenever  I  add  128  to  any of the basic colors,  they become 
  706.          flashing characters.  Once again, a sample program: 
  707.  
  708.                            Program Title_Test;
  709.  
  710.                            {$I VAR.INC}
  711.                            {$I WINDMNGR.INC}
  712.                      
  713.                            Begin
  714.                                 Add_Window(3,3,60,10,1,7,3);
  715.                                 Window_Title('TEST TITLE',(128+12)+(7*16))
  716.                              end.
  717.  
  718.  
  719.  
  720. THE WINDOW MANAGER                                                     PAGE  12
  721.  
  722.  
  723.          
  724.          E--Select_Window--F Procedure         E--_____________--F          
  725.  
  726.               If you have defined an include file  with  EWINDODEF.COMF  or 
  727.          have  calculated  the  values  yourself,  then  you  may use the 
  728.          Select_Window  procedure.   (See  section  on  WINDODEF.COM  for 
  729.          information on defining windows to be used in your program).  
  730.  
  731.          Syntax:
  732.          
  733.                           Select_Window(<EWindow numberF>);              
  734.  
  735.          Where:
  736.                          EWindow numberF is the number of the window 
  737.                                          to activate.
  738.  
  739.          Example Call:
  740.  
  741.                           Select_Window(1);
  742.  
  743.               This little call activates a pre-defined window number one.
  744.  
  745.                            -A Little on defining windows-
  746.  
  747.               Windows may be defined in an array and implemented into  an 
  748.          include  file  as constants easily making it possible to lay out 
  749.          your windows before implementing them  in  your  program.  There 
  750.          are essentially two possible ways of doing this.  You can either 
  751.          figure  them  out  for  yourself or use the EWINDODEF.COMF program 
  752.          included in this package  which  will  do  -everything-  described 
  753.          below.  The  operation  of  the windodef program is explained in 
  754.          the Windodef section.  I will explain how to do it yourself (the 
  755.          harder way),  but I suggest you skip this section and  read  the 
  756.          -Using EWINDODEF.COMF- section.  
  757.           
  758.               Ok,  Here goes..  The values for windows can be pre-defined 
  759.          and added to your programs.  The way to do this is to figure out 
  760.          where you want your windows to appear on the  screen  and  enter 
  761.          them  into  constants  and have the procedure create the windows 
  762.          for you.  First, write down the x,y coordinates, attributes, and 
  763.          titles for your windows.  The next step will be to put them into 
  764.          2  constants.  The  syntax  for  the  Include  procedure  is  as 
  765.          follows.  
  766.  
  767.          PROCEDURE SELECT_WINDOW(WIN_NUM: INTEGER);
  768.          
  769.          CONST WINDOWS: ARRAY[1..9,1..8] OF INTEGER =
  770.          (<X1>,<Y1>,<X2>,<Y2>,<Foregrnd>,<backgrnd>,<Frame>,
  771.          <Title Color>,     {Window 1}
  772.          ("  "         "           "       "  ), {Window 8}
  773.          (0,0,0,0,0,0,0,0)); {end flag,must be present}
  774.  
  775.          CONST TITLE: ARRAY[1..9] OF STRING[80] =
  776.          ('Title #1',....,'Title #8','');
  777.  
  778.          BEGIN
  779.  
  780. THE WINDOW MANAGER                                                     PAGE  13
  781.  
  782.  
  783.               IF (WINDOW[WIN_NUM,7] > 0) AND (WIN_NUM > STACK_TOP) THEN
  784.                      BEGIN
  785.                           ADD_WINDOW(WINDOWS[WIN_NUM,1],
  786.                                      WINDOWS[WIN_NUM,2],
  787.                                      WINDOWS[WIN_NUM,3],
  788.                                      WINDOWS[WIN_NUM,4],
  789.                                      WINDOWS[WIN_NUM,5],
  790.                                      WINDOWS[WIN_NUM,6],
  791.                                      WINDOWS[WIN_NUM,7);
  792.                           IF TITLE[WIN_NUM] <> '' THEN
  793.                                       WINDOW_TITLE(TITLE[WIN_NUM],
  794.                                                    WINDOWS[WIN_NUM,8]);
  795.                      END
  796.               ELSE
  797.                      IF WINDOWS[WIN_NUM,4] > 0 THEN
  798.                           BEGIN
  799.                                IMIG[LAST_WINDOW_NUM].W1:=WHEREX;
  800.                                IMIG[LAST_WINDOW_NUM].W2:=WHEREY;
  801.                                WINDOW(1,1,80,25);
  802.                                GOTOXY(1,1);
  803.                                WITH IMIG[WIN_NUM] DO
  804.                                      BEGIN
  805.                                           WINDOW(X1,Y1,X2,Y2);
  806.                                           TEXTCOLOR(C1+(B1*16))
  807.                                      END;
  808.                                GOTOXY(1,1);
  809.                                GOTOXY(IMIG[WIN_NUM].W1,IMIG[WIN_NUM].W2);
  810.                                LAST_WINDOW_NUM:=WIN_NUM
  811.                           END
  812.          END;
  813.          
  814.          (See EDEMODEFS.INCF to see the real procedure)
  815.          That's it..  Although,  it's much easier to use the EWINDODEF.COMF 
  816.          program.  
  817.          
  818.  
  819.  
  820.  
  821.  
  822.  
  823.  
  824.  
  825.  
  826.  
  827.  
  828.  
  829.  
  830.  
  831.  
  832.  
  833.  
  834.  
  835.  
  836.  
  837.  
  838.  
  839.  
  840. THE WINDOW MANAGER                                                     PAGE  14
  841.  
  842.  
  843.          
  844.                            E-Other Functions & ProceduresF-
  845.  
  846.               Along  with  the  main procedures described in the previous 
  847.          section,  there are also some smaller functions  and  procedures 
  848.          within  the window manager routines which may be accessed by the 
  849.          user.  In this section,  we will discuss these and some of their 
  850.          applications.  
  851.  
  852.          EActiveF function
  853.  
  854.               This function returns the number of windows that are pushed 
  855.          on the stack (on the screen).  This number will be between  1 
  856.          and 8 unless the source code is modified to handle more windows.  
  857.          See the section on modifying the source code.  
  858.  
  859.          Syntax:
  860.  
  861.                                <EVariableF> := Active;
  862.  
  863.          Where:
  864.               
  865.                                 EVariableF is an integer variable;        
  866.  
  867.          Example call:
  868.  
  869.                                Windows_Up := Active;
  870.  
  871.  
  872.               This   example  call  will  assign  the  declared  variable 
  873.          Windows_Up to the number of windows that are on  the  screen.  A 
  874.          use  for  this  may be to  clear  all the active windows off the 
  875.          screen like this: 
  876.  
  877.                                   Remove(Active);
  878.  
  879.          E--Set_Page--F Procedure         E--________--F          
  880.  
  881.              Used to set the current video page.  That is,  the  area  in 
  882.          video  RAM  wich  is displayed on the screen.  There are four 4K 
  883.          pages in color (Pages 0 though 3) mode and  eight  2K  pages  in 
  884.          Monochrome mode (Pages 0 through 7).  
  885.  
  886.          Syntax:
  887.  
  888.                                  Set_Page(<EByteF>);
  889.  
  890.          Where:
  891.  
  892.                                  EByteF is a byte value within the range 
  893.                                         $00 though $03 for color and $00
  894.                                         through $07 in mono. 
  895.  
  896.           Example call:
  897.  
  898.                                   Set_Page($01);
  899.  
  900. THE WINDOW MANAGER                                                     PAGE  15
  901.  
  902.  
  903.  
  904.              Sets  the current video page to page 1 allowing you to write 
  905.          to page 0 with regular writeln  and  write  routines.  Try  this 
  906.          small example program: 
  907.  
  908.                               Program Switch_Page;
  909.  
  910.                               {$I VAR.INC}
  911.                               {$I WINDMNGR.INC}
  912.  
  913.                               Var i: Integer;
  914.  
  915.                               Begin
  916.                                    ClrScr;
  917.                                    Set_Page($01);
  918.                                    For i:=1 to 300 do write(' Hello ');
  919.                                    Set_Page($00)
  920.                               end.
  921.  
  922.               This little program will clear the screen,  switch to video 
  923.          page #1, which will remain cleared, fill page 0 with Hello's and 
  924.          then switch back to page 0 creating the illusion of speed.  
  925.  
  926.               If  you  are adventurous you can play around with the other 
  927.          various procedures within the window  manager  routines.  Within 
  928.          the source are routines to write directly to screen memory, turn 
  929.          off the crt, bypass the windows and write directly to screen 
  930.          memory, draw boxes, and various other things...
  931.            
  932.  
  933.  
  934.  
  935.  
  936.  
  937.  
  938.  
  939.  
  940.  
  941.  
  942.  
  943.  
  944.  
  945.  
  946.  
  947.  
  948.  
  949.  
  950.  
  951.  
  952.  
  953.  
  954.  
  955.  
  956.  
  957.  
  958.  
  959.  
  960. THE WINDOW MANAGER                                                     PAGE  16
  961.  
  962.  
  963.          
  964.                        E-Using WINDODEF.COM to define windowsF-
  965.  
  966.  
  967.              There  is  also  a  program included with the package called 
  968.          EWINDODEF.COMF.  This program may be used  to  pre-define  windows 
  969.          for  implementing  into  your  own  Turbo  Pascal programs.  The 
  970.          purpose of this program is to write a E$IFnclude file.  To do this 
  971.          just invoke the program by typing its name at the Ms-dos prompt.  
  972.          A menu will be displayed with EWINDODEFF  functions  numbered  one 
  973.          through five.  We will discuss each of these.  
  974.  
  975.          -Option 1:- Edit/Configure window file
  976.  
  977.               When  this option is selected the screen is cleared and you 
  978.          are asked which window number to define.  At this point enter an 
  979.          integer  value  in between one and eight.  A small 5 by 5 window 
  980.          is placed in the upper left hand corner of the screen.  Use  the 
  981.          cursor  keys  to  move  this  box around.  An explanation of the 
  982.          function keys is printed at the top of the  screen.  The  window 
  983.          can be moved,  expanded,  titled, re-framed, and colored.  After 
  984.          you have the window adjusted to your desires,  just hit function 
  985.          key  ten  to return to the main menu.  Now you may select one of 
  986.          the other options from the menu or define another window.  
  987.           
  988.          -Option 2:- Save definitions to disk file
  989.          
  990.               After you have completed  defining  all  of  your  windows, 
  991.          select  this  option  to save the files to an include file which 
  992.          you may easily incorporate into  your  own  Turbo  program.  The 
  993.          file  is  saved to disk under the name EDEFS.INCF.  After the file 
  994.          is saved you may rename it to whatever you want  at  dos  level.  
  995.          To use your definitions in a Turbo program,  just make the first 
  996.          three lines of your program: 
  997.           
  998.                               {$I VAR.INC}
  999.                               {$I WINDMNGR.INC}
  1000.                               optional {$I GROWWIN.INC}
  1001.                               {$I DEFS.INC}
  1002.  
  1003.               You may now use the select_window  procedure  described  in 
  1004.          the  previous  section.   See  the  EDEMODEFS.INCF  file  and  the 
  1005.          EDEFDEMO.*F programs.  
  1006.  
  1007.          -Option 3:- Clear defined window
  1008.  
  1009.               This option may be selected to clear a window that you have 
  1010.          defined.  This is a precaution in case you mess up a window  and 
  1011.          have  all the others defined (or some of the windows).  You will 
  1012.          be prompted with  "Clear  window  number  #:".  Just  enter  the 
  1013.          number  of  the  window  you  wish to be cleared and that window 
  1014.          number will be completely reset.  
  1015.  
  1016.  
  1017.  
  1018.  
  1019.  
  1020. THE WINDOW MANAGER                                                     PAGE  17
  1021.  
  1022.  
  1023.           
  1024.          -Option 4:- Display defined windows simultaneously
  1025.  
  1026.               This option may be selected  to  display  all  your  defined 
  1027.          windows  on the screen at once so you can see what they look 
  1028.          like all together.  
  1029.  
  1030.          -Option 5:- Exit to system
  1031.          
  1032.               This  option  is  pretty  much  self  explanatory.  Just -be -
  1033.          -certain- to save your windows before exiting.  
  1034.  
  1035.  
  1036.  
  1037.  
  1038.  
  1039.  
  1040.  
  1041.  
  1042.  
  1043.  
  1044.  
  1045.  
  1046.  
  1047.  
  1048.  
  1049.  
  1050.  
  1051.  
  1052.  
  1053.  
  1054.  
  1055.  
  1056.  
  1057.  
  1058.  
  1059.  
  1060.  
  1061.  
  1062.  
  1063.  
  1064.  
  1065.  
  1066.  
  1067.  
  1068.  
  1069.  
  1070.  
  1071.  
  1072.  
  1073.  
  1074.  
  1075.  
  1076.  
  1077.  
  1078.  
  1079.  
  1080. THE WINDOW MANAGER                                                     PAGE  18
  1081.  
  1082.  
  1083.           
  1084.            
  1085.                         E-The Window Manager under Monochrome-F
  1086.            
  1087.  
  1088.               To the best of my knowledge,  this program will  work  fine 
  1089.          under  IBM  Monochrome  Graphics.  All  that  need be done is to 
  1090.          change the statement EScreen_Seg = $B800F in the EVAR.INCF  file  to 
  1091.          EScreen_Seg = $B000F.  That's all,  and be sure to watch what text 
  1092.          colors you use.  
  1093.               
  1094.          
  1095.  
  1096.  
  1097.  
  1098.  
  1099.  
  1100.  
  1101.  
  1102.  
  1103.  
  1104.  
  1105.  
  1106.  
  1107.  
  1108.  
  1109.  
  1110.  
  1111.  
  1112.  
  1113.  
  1114.  
  1115.  
  1116.  
  1117.  
  1118.  
  1119.  
  1120.  
  1121.  
  1122.  
  1123.  
  1124.  
  1125.  
  1126.  
  1127.  
  1128.  
  1129.  
  1130.  
  1131.  
  1132.  
  1133.  
  1134.  
  1135.  
  1136.  
  1137.  
  1138.  
  1139.  
  1140. THE WINDOW MANAGER                                                     PAGE  19
  1141.  
  1142.  
  1143.          
  1144.                              E-Modifying the source codeF-
  1145.  
  1146.  
  1147.               If you would like to have more than eight  windows  on  the 
  1148.          screen at once, this is possible by modifying the source code of 
  1149.          the  EVAR.INCF  file  to  handle this.  There is a constant called 
  1150.          -MAX_SCREENS- that may be changed to either a higher number  or  a 
  1151.          lower  number.  If  it  is  changed  to  a  higher number,  each 
  1152.          additional window will require 4K of memory.  Be sure  you  have 
  1153.          enough  memory  to suit the adjustment.  Memory can be conserved 
  1154.          by lowering the number of possible windows.  This will  save  4K 
  1155.          for each additional window removed.  
  1156.              The  constant  -DATA_ADDRESS-  points  to  page  one  in video 
  1157.          memory.  By incrementing this constant, the windows can be drawn 
  1158.          into any portion of video memory.  
  1159.              You  can  peek  through the source code and remove un-needed 
  1160.          procedures whenever you are writing a program.  This  will  also 
  1161.          save  on memory. 
  1162.              Please DO NOT  distribute  any  modofied  versions  of  this 
  1163.          program.  I  wouldn't  like  people calling me and saying,  "Hey 
  1164.          Jim,  this and this doesn't work!".  Oh well,  thanks for  using 
  1165.          the program and I really hope you enjoy it.  
  1166.  
  1167.  
  1168.  
  1169.  
  1170.  
  1171.  
  1172.  
  1173.  
  1174.  
  1175.  
  1176.  
  1177.  
  1178.  
  1179.  
  1180.  
  1181.  
  1182.  
  1183.  
  1184.  
  1185.  
  1186.  
  1187.  
  1188.  
  1189.  
  1190.  
  1191.  
  1192.  
  1193.  
  1194.  
  1195.  
  1196.  
  1197.  
  1198.  
  1199.  
  1200. THE WINDOW MANAGER                                                     PAGE  20
  1201.  
  1202.  
  1203.          
  1204.                               E-Quick Reference SectionF-
  1205.  
  1206.  
  1207.          -Basic layout of your program should be as follows.-
  1208.  
  1209.          Program <program name>;
  1210.  
  1211.          {$I VAR.INC}
  1212.          {$I WINDMNGR.INC}
  1213.          <optional {$I GROWWIN.INC}>
  1214.          <optional {$I DEFS.INC}>  <== may be renamed
  1215.  
  1216.          Your procedures and functions go here
  1217.  
  1218.          begin {Main program body}
  1219.                 Inititialize;
  1220.                 more code...
  1221.                  -
  1222.                  -
  1223.                  - 
  1224.          end. {end main}
  1225.  
  1226.          -Procedures:-
  1227.  
  1228.          Initialize;    {Initializes stack, must be first line}
  1229.  
  1230.          Add_Window(<x1>,<y1>,<x2>,<y2>,<Foregrnd>,<Backgrnd>,<Frame>);
  1231.  
  1232.                         {Adds a window of specified size}
  1233.  
  1234.          Grow_window(<x1>,<y1>,<x2>,<y2>,<Foregrnd>,<Backgrnd>,<Frame>);
  1235.  
  1236.                         {Same as add_window only window appears to grow}
  1237.          
  1238.          Remove<<# to remove>);  {removes a specified # of windows}
  1239.  
  1240.          Color_Window(<Foregrnd>,<Backgrnd>); 
  1241.  
  1242.                         {Change color attributes of window}
  1243.  
  1244.          Window_Title('<Title>',<Color>);
  1245.  
  1246.                         {Adds a title to your window, color is determined
  1247.                          by the formula color = forgrnd+(backgrnd * 16)}
  1248.  
  1249.          Select_Window(<Window #>);
  1250.  
  1251.                         {Selects a predefined window, if window is 
  1252.                          already up, then it is just reactivated}
  1253.  
  1254.          Active;   {Assign the number of active windows to itself, 
  1255.                     Function}
  1256.  
  1257.          Set_Page(<byte>); {sets active video page}
  1258.  
  1259.  
  1260. THE WINDOW MANAGER                                                     PAGE  21
  1261.  
  1262.  
  1263.          
  1264.          -Text color values-
  1265.  
  1266.                 0 black                 8  gray
  1267.                 1 blue                  9  light blue
  1268.                 2 green                 10 light green
  1269.                 3 cyan                  11 light cyan
  1270.                 4 red                   12 light red
  1271.                 5 magenta               13 light magenta
  1272.                 6 brown                 14 yellow
  1273.                 7 white                 15 high intensity white
  1274.  
  1275.          Note: Adding 128 to any color makes it a blinking color.
  1276.  
  1277.  
  1278.  
  1279.  
  1280.  
  1281.  
  1282.  
  1283.  
  1284.  
  1285.  
  1286.  
  1287.  
  1288.  
  1289.  
  1290.  
  1291.  
  1292.  
  1293.  
  1294.  
  1295.  
  1296.  
  1297.  
  1298.  
  1299.  
  1300.  
  1301.  
  1302.  
  1303.  
  1304.  
  1305.  
  1306.  
  1307.  
  1308.  
  1309.  
  1310.  
  1311.  
  1312.  
  1313.  
  1314.  
  1315.  
  1316.  
  1317.  
  1318.  
  1319.  
  1320. THE WINDOW MANAGER                                                     PAGE  22
  1321.  
  1322.  
  1323.          
  1324.  
  1325.  
  1326.  
  1327.  
  1328.  
  1329.          Hello.....
  1330.  
  1331.                 I am a student at The Pennsylvania State  University  and 
  1332.          am  in  need  of  some  extra  work.  If  you  need  any program 
  1333.          conversions, custom programming, etc..  Please give me a call or 
  1334.          write me.  I work for  cheap!  I  program  in  Pascal,  Fortran, 
  1335.          PL/1,  PL/C,  and  Basic.  By  June  85 I shall also know PDP-11 
  1336.          Assembler, 8088 Assembler, and IBM SYS/370 Assembler.  So if you 
  1337.          have some work, give a ring.  
  1338.  
  1339.                                         Thanks,
  1340.  
  1341.                                         Jim Everingham
  1342.  
  1343.  
  1344.  
  1345.  
  1346.                              Jim Everingham
  1347.                              318 East Sheridan Avenue
  1348.                              DuBois Pa., 15801
  1349.                              814-238-9655 or
  1350.                              814-371-1355 after June 85
  1351.                              CIS: 75116,433
  1352.  
  1353.  
  1354.  
  1355.  
  1356.  
  1357.  
  1358.  
  1359.  
  1360.  
  1361.  
  1362.  
  1363.  
  1364.  
  1365.  
  1366.  
  1367.  
  1368.  
  1369.  
  1370.  
  1371.  
  1372.  
  1373.  
  1374.  
  1375.  
  1376.  
  1377.  
  1378.  
  1379.  
  1380. THE WINDOW MANAGER                                                     PAGE  23
  1381.